package hc.server.ui;

import hc.core.util.Stack;

public class MCanvasHelper {
	private Stack canvasStack = new Stack();
	
	public MCanvas getBackCanvas(){
		if(canvasStack.size() == 0){
			return null;
		}else{
			return (MCanvas)canvasStack.pop();
		}
	}
	
	public void buildMCanvas(int width, int height, Class mcanvasClass){
		try {
			MCanvas canvas = (MCanvas)mcanvasClass.newInstance();
//			canvas.init(width, height);
			
			canvasStack.push(canvas);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void release(){
		canvasStack.removeAllElements();
	}
}
